/**
 * [Copyright 2019  zt 分布式代码生成工具
 * <p>
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <p>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <p>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.base.test.rabbitmq.service;

import com.base.commons.mybatis.service.BaseService;
import com.base.commons.tools.page.PageData;
import com.base.test.rabbitmq.dto.MqSendResp;
import com.base.test.rabbitmq.dto.MqSendPageReq;
import com.base.test.rabbitmq.entity.MqSendEntity;

/**
 * mq生产者消息表
 * @author qiaodong
 * @since 2020-08-27
 */
public interface MqSendService extends BaseService<MqSendEntity> {

    /**
     * mq生产者消息分页
     * @param dto
     * @return
     */
    PageData<MqSendResp> page(MqSendPageReq dto);

    /**
     * 获取生产者信息
     * @param id
     * @return
     */
    MqSendResp get(String id);

    /**
     * 乐观锁实现重试次数累加
     * @param msgId
     * @param retryCount
     * @return
     */
    int addRetryCount(String msgId,Integer retryCount,String remark);

    /**
     * 根据msgId进行保存或更新
     * @param dto
     * @return
     */
    int checkSendInsertOrUpdate(MqSendEntity dto);

    /**
     * 根据消息ID进行查询
     * @param msgId
     * @return
     */
    MqSendEntity getByMsgId(String msgId);

    /**
     * 删除几天前发送成功的消息
     * @param day
     * @return
     */
    int deleteSuccessMsg(Integer day);
}